package com.youbo.cloudmall.product.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

/**
 * @author youbo
 * @version 1.0
 * @date 2021/10/13 18:07
 */
@Configuration
public class MyRedissonConfig {

    /**
     * 所有对Redisson的使用都是通过RedissonClient来操作
     * @param
     * @return org.redisson.api.RedissonClient
     */

    @Bean(destroyMethod = "shutdown")
    public RedissonClient redisson() throws IOException{
        Config config = new Config();
        config.useSingleServer()
                .setAddress("redis://150.158.170.135:6222")
                .setPassword("130848");
        return Redisson.create(config);
    }
}
